package etllog2;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

/**
 * @program: WCount
 * @description: 驱动类
 * @author: Qiang.Ye
 * @create: 2019-05-23 06:25
 **/
public class LogDriver {


    public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {

        //
        args = new String[]{"D:\\data\\wcdata\\web.txt","D:\\data\\demodatas\\logdemo2"};

        //1.获取配置信息
        Configuration conf = new Configuration();

        Job job = Job.getInstance(conf);

        //2.加载反射类
        job.setMapperClass(LogMapper.class);
        job.setJarByClass(LogDriver.class);

        //3.map的输出和Reduce输出的类型
        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(NullWritable.class);


        //4.输入数据和输出数据的路径
        FileInputFormat.setInputPaths(job,new Path(args[0]));
        FileOutputFormat.setOutputPath(job,new Path(args[1]));

        //5.job提交
        job.waitForCompletion(true);








    }


}
